import numpy as np
import matplotlib.pyplot as plt
from src import heuristics, problems, measure, astar_solution

N = 5

prob_sets = problems.incrementing_obs_sets(N, 10)
ps = [0.5,1,1.5,3.5,5]

s_manhatan_data={}


for p in ps:
    algo = astar_solution.astar_solution(heuristics.scaled_manhattan_dirt(p))
    s_manhatan_data[p] = measure.measureSucceed(prob_sets, algo)

###############################################################################
# plotting the data
###############################################################################

ind = np.arange(N)  # the x locations for the groups
width = 0.15     # the width of the bars

ax = plt.subplot(111)
colors = ['r','g','y','b','c','m','k']

bars = {}
i = 0
for p in ps:
    bars[p]= plt.bar(ind+i*width, s_manhatan_data[p], width, color=colors[i])
    i += 1

b = []
p = []
for  pi, bar  in bars.items():
    b.append(bar[0])
    p.append('p = '+str(pi))

  
plt.legend( b,p, loc='upper left' )
plt.show()
